﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Configuration.Install;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Xml;
using Baggr.FeedParser;

namespace Baggr.Agent
{
    public static class Registrator
    {
        public static void Main(string[] args)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["agent"].ConnectionString;
            var task = new FeedUpdateTask(connectionString);
            var res = task.BeginExecute(result => {});
            task.EndExecute(res);
            return;
            var parameters = args.Select(curr => curr.ToUpper());
            if (args.Length == 0)
            {
                ServiceBase.Run(new AgentService());
            }
            else
            {
                if (parameters.Contains("U"))
                {
                    ManagedInstallerClass.InstallHelper(new[] {"/u", Assembly.GetExecutingAssembly().Location});
                }

                if (parameters.Contains("I"))
                {
                    ManagedInstallerClass.InstallHelper(new[] {Assembly.GetExecutingAssembly().Location});
                }
            }
        }
    }
}
